package com.lora.websocket.message;

import com.acooly.core.common.web.support.JsonEntityResult;
import com.alibaba.fastjson.JSONObject;
import com.lora.websocket.WebSocketServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class WebSockerSender {

	private static final Logger logger = LoggerFactory.getLogger(WebSockerSender.class);

	public void sendMsgToAllClient(String equipmentNum, Object msg, boolean alarm) {
		JsonEntityResult<Object> result = new JsonEntityResult<>();
		result.setEntity(msg);
		result.setCode(equipmentNum);
		result.setSuccess(alarm);
		WebSocketServer.sendMessageToAll(JSONObject.toJSONString(result));
	}

}
